<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
    MaintainScrollPositionOnPostback="true" CodeFile="ApplicationDataEntryView.aspx.cs"
    Inherits="ApplicationDataEntryView" Title="APM - Application Entry" %>

<%@ Register TagPrefix="spm" TagName="LifeCycleGraphics" Src="~/Controls/LifeCycleGraphics.ascx" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <ul id="path">
        <li><a href="../Home.aspx">Home</a> &gt;</li>
        <li>Application &gt;</li>
        <li>Application Entry</li>
    </ul>
    <h3 class="entry"><span>Application Entry</span></h3>
    <div id="content">
        <div id="tabgroup">
            <ul class="tabs">
                <li id="addl" runat="server">
                    <asp:LinkButton ID="lbnew" Style="text-align: center" runat="server" CausesValidation="false"
                        Text="Add New Application" ToolTip="For adding new application entry into system."
                        OnClick="lbnew_Click"></asp:LinkButton></li>
                <li id="viewl" runat="server" class="active">
                    <asp:LinkButton ID="lbview" runat="server" Style="text-align: center" CausesValidation="false"
                        Text=" View Application Data " ToolTip="For viewing existing applications in the system."
                        OnClick="lbview_Click"></asp:LinkButton></li>
                <li id="editl" runat="server">
                    <asp:LinkButton ID="lbedit" runat="server" Style="text-align: center" CausesValidation="false"
                        Text=" Edit Application Data" ToolTip="For editing existing applications in the system."
                        OnClick="lbedit_Click"></asp:LinkButton></li>
            </ul>
            <div class="frame" style="min-height: 550px;">
                <asp:Panel ID="pnlApplication" runat="server" Width="100%" Visible="false">
                <asp:Panel ID="pnlAppMetaData" runat="server" GroupingText="Application Metadata">
                <table width="98%">
                    <tr>
                        <td align="left" valign="top" style="font-weight: bold">
                            Application Creator:
                        </td>
                        <td>
                            <asp:Label runat="server" ID="lblVAppOwner"></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <td align="left" style="width: 150px; font-weight: bold" valign="top">
                            Application ID:
                        </td>
                        <td>
                            <asp:Label runat="server" ID="lblVAppID"></asp:Label>&nbsp;&nbsp;<asp:LinkButton
                            runat="server" Text="(Edit this Application)" ID="lnkedit" OnClick="lnkedit_Click"></asp:LinkButton>
                            &nbsp;<asp:LinkButton runat="server" Text="(Copy Application Metadata)" ToolTip="Click here to copy the Metadata, Properties and Contacts of this Application." 
                            ID="lnkCopy" OnClick="lnkCopy_Click">
                            </asp:LinkButton>     
                        </td>
                    </tr>
                    <tr>
                        <td align="left" valign="top" style="font-weight: bold">
                            Application Name:
                        </td>
                        <td>
                            <asp:Label runat="server" ID="lblVAppName"></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <td align="left" valign="top" style="font-weight: bold">
                            Organization Name:
                        </td>
                        <td>
                            <asp:Label runat="server" ID="lblVOrgName"></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <td align="left" valign="top" style="font-weight: bold">
                            Version Number:
                        </td>
                        <td>
                            <asp:Label runat="server" ID="lblVVersionNumber"></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <td align="left" valign="top" style="font-weight: bold">
                            Description:
                        </td>
                        <td>
                            <asp:Label runat="server" ID="lblVDescription"></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <td align="left" valign="top" style="font-weight: bold">
                            Start Date:
                        </td>
                        <td>
                            <asp:Label runat="server" ID="lblVStartDate"></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <td align="left" valign="top" style="font-weight: bold">
                            Est. Completed Date:
                        </td>
                        <td>
                            <asp:Label runat="server" ID="lblVEstimatedCompDate"></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <td align="left" valign="top" style="font-weight: bold">
                            Actual Completed Date:
                        </td>
                        <td>
                            <asp:Label runat="server" ID="lblVActualCompletedDate"></asp:Label>
                        </td>
                    </tr>
                </table>
                </asp:Panel>
                <table width="100%">
                    <tr>
                        <td>
                            <br />
                            Existing Application Properties
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <asp:GridView ID="gvProperty" runat="server" AllowPaging="True" AutoGenerateColumns="False" DataSourceID="obdsProperty"
                                AutoGenerateEditButton="False" CssClass="table" DataKeyNames="AttributeID" EmptyDataText="No Properties found."
                                PageSize="4" >
                                <AlternatingRowStyle CssClass="alternate" />
                                <PagerSettings Position="Top" />
                                <PagerStyle CssClass="pages" />
                                <EmptyDataRowStyle BackColor="#C4D7D6" BorderStyle="none" />
                                <HeaderStyle HorizontalAlign="Left" />
                                <Columns>
                                <asp:BoundField ReadOnly="true" HtmlEncode="true" HeaderText="Property Name" DataField="AttributeName" />
                                </Columns>
                                <RowStyle HorizontalAlign="Left" />
                            </asp:GridView>
                            <asp:ObjectDataSource ID="obdsProperty" runat="server" TypeName="Microsoft.AceEngineering.SPM.SPMBusinessLayer.ApplicationsBL"
                            SelectMethod="GetSelectedAttributesforApplication" OldValuesParameterFormatString="{0}" OnSelecting="obdsProperty_Selecting">
                                    <SelectParameters>
                                <asp:Parameter Name="appID" Type="String" />
                            </SelectParameters>
                        </asp:ObjectDataSource>
                        </td>
                    </tr>
                </table>
                <table width="100%">
                    <tr>
                        <td>
                            <br />
                            Existing Application Contacts
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <asp:GridView ID="gridApplicationContact" runat="server" AllowPaging="True" AutoGenerateColumns="False"
                                AutoGenerateEditButton="False" CssClass="table" DataSourceID="obdsContact"
                                DataKeyNames="ContactTypeID" EmptyDataText="No Contacts found."
                                PageSize="10">
                                <AlternatingRowStyle CssClass="alternate" />
                                <PagerSettings Position="Top" />
                                <PagerStyle CssClass="pages" />
                                <EmptyDataRowStyle BackColor="#C4D7D6" BorderStyle="none" />
                                <HeaderStyle HorizontalAlign="Left" />
                                <Columns>
                                    <asp:BoundField ReadOnly="true" HtmlEncode="true" HeaderText="Alias" DataField="Alias" />
                                     <asp:BoundField ReadOnly="true" HtmlEncode="true" HeaderText="Contact Type" DataField="ContactTypeName" ItemStyle-Width="190"/>
                                   <asp:BoundField ReadOnly="true" HtmlEncode="true" HeaderText="Name" DataField="Name" ItemStyle-Width="190"/>
                                     <asp:BoundField ReadOnly="true" HtmlEncode="true" HeaderText="E-mail" DataField="Email" ItemStyle-Width="190"/>
                                </Columns>
                                <RowStyle HorizontalAlign="Left" />
                            </asp:GridView>
                             <asp:ObjectDataSource ID="obdsContact" runat="server" TypeName="Microsoft.AceEngineering.SPM.SPMBusinessLayer.ApplicationsBL"
                            SelectMethod="GetContactsByAppID" OldValuesParameterFormatString="{0}" OnSelecting="obdsContact_Selecting">
                            <SelectParameters>
                                <asp:Parameter Name="appID" Type="String" />
                            </SelectParameters>
                        </asp:ObjectDataSource>
                        </td>
                    </tr>
                </table>
                <br />
                <spm:LifeCycleGraphics ID="LCGraphics" runat="server" />
                <br />
                <asp:Button ID="btnBack" runat="server" Text="Back" OnClick="btnBack_Click" CausesValidation="False" />
                </asp:Panel>
                <asp:Panel ID="pnlSearch" runat="server" Width="100%" Visible="false">
                    <table class="table" border="0" cellpadding="0" cellspacing="0" width="100%">
                        <tr align="center">
                            <th colspan="2">
                                Quick Search
                            </th>
                        </tr>
                        <tr>
                            <td align="left" style="padding: 0 0 0 0;" colspan="2">
                                <asp:HiddenField runat="server" ID="appID" Value="0" Visible="false" />
                                <asp:RadioButtonList ToolTip="Select to search by Application Name or by Application ID."
                                    runat="server" ID="rdsearchType" AutoPostBack="false" TextAlign="Right" RepeatDirection="Horizontal">
                                    <asp:ListItem Selected="true" Value="0"> Search by Application Name</asp:ListItem>
                                    <asp:ListItem Value="1">Search by Application ID</asp:ListItem>
                                </asp:RadioButtonList>
                            </td>
                        </tr>
                        <tr>
                            <td align="left" colspan="2">
                                <table cellpadding="0" cellspacing="0">
                                    <tr>
                                        <td align="left" style="padding: 0 0 0 0;">
                                            <asp:TextBox ID="txtSearch" runat="server" MaxLength="50" ValidationGroup="search"
                                                Width="220" CssClass="input"></asp:TextBox>
                                            <asp:RequiredFieldValidator ValidationGroup="search" ID="reqAppName" runat="server"
                                                ControlToValidate="txtSearch" ErrorMessage="Required Field: Application Name/ID"
                                                Display="None" SetFocusOnError="True"></asp:RequiredFieldValidator>
                                            <asp:RegularExpressionValidator ValidationGroup="search" ID="reguAppName" runat="server"
                                                ControlToValidate="txtSearch" ErrorMessage="Invalid Input: Application Name/ID"
                                                ValidationExpression="<%$ AppSettings:AppNameRegEx %>" Display="None"></asp:RegularExpressionValidator>
                                            <asp:Button ID="btnSearch" runat="server" ValidationGroup="search" OnClick="btnSearch_Click"
                                                Text="Search" />
                                        </td>
                                        <td>
                                            &nbsp;Example - Microsoft Word or 56</td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                        <tr>
                            <td align="left" colspan="2">
                                <asp:Label ID="lblResult" runat="server" Text="Select Application" Visible="false"></asp:Label>
                            </td>
                        </tr>
                        <tr>
                            <td align="left" colspan="2">
                                <asp:ListBox Width="275" Rows="5" ID="lstApplicationNames" runat="server" Visible="False"></asp:ListBox>
                                <asp:RequiredFieldValidator ValidationGroup="Go" ID="RequiredFieldValidator1" runat="server"
                                    ControlToValidate="lstApplicationNames" ErrorMessage="No application was selected."
                                    Display="None" SetFocusOnError="True"></asp:RequiredFieldValidator>
                                <asp:ValidationSummary ValidationGroup="Go" ID="ValidationSummary1" runat="server"
                                    HeaderText="Please correct the following:" ShowMessageBox="true" ShowSummary="false"
                                    DisplayMode="BulletList" />
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" align="left">
                                <asp:Button ID="btnGo" runat="server" ValidationGroup="Go" OnClick="btnGo_Click"
                                    CausesValidation="true" Text="Select" Visible="false" />
                                <asp:ValidationSummary ValidationGroup="search" ID="commonValidation" runat="server"
                                    HeaderText="Please correct the following:" ShowMessageBox="true" ShowSummary="false"
                                    DisplayMode="BulletList" />
                            </td>
                        </tr>
                    </table>
                </asp:Panel>
            </div>
        </div>
    </div>
</asp:Content>
